/**
 * 
 */
package com.lemote.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

/**
 * @author wuhui
 *
 * 下午02:08:59
 */
@Entity
@Table(name="smt_model")
//默认的缓存策略.
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class Model extends IdEntity {

	private String name;
	
	private String ename;
	
	private String url;
	
	private Model parent;
	
	private List<Model> children;
	
	private String status;

	@OneToMany(mappedBy = "parent", cascade = { CascadeType.REFRESH,CascadeType.REMOVE }, fetch = FetchType.LAZY, targetEntity = Model.class)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public List<Model> getChildren() {
		return children;
	}

	public String getEname() {
		return ename;
	}

	public String getName() {
		return name;
	}

	@ManyToOne
	@JoinColumn(name="pid")
	public Model getParent() {
		return parent;
	}

	public String getStatus() {
		return status;
	}

	public String getUrl() {
		return url;
	}

	public void setChildren(List<Model> children) {
		this.children = children;
	}

	public void setEname(String ename) {
		this.ename = ename;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setParent(Model parent) {
		this.parent = parent;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public void setUrl(String url) {
		this.url = url;
	}
	
	
	
}
